//
//  CLBaseParam.m
//  togetherLBS
//
//  Created by louis on 15/7/30.
//  Copyright (c) 2015年 celi. All rights reserved.
//

#import "CLBaseParam.h"
#import "CLDeviceIOS.h"
#import "CLEncoder.h"
#import "CLProfileInfo.h"
// 网络请求安全密匙
static NSString const *secureKey = @"yvAfFVpX0xoTeAVT6AsCHycxZeWOvvB3";

@implementation CLBaseParam
- (instancetype)init
{
    if (self = [super init]) {
//        _did = [CLDeviceIOS single].device_id;
        _lang = [CLDeviceIOS single].lang;
//        self.pid = @300;
        _tlb = [CLDeviceIOS single].app_build;
        _t = [[NSDate date] timeIntervalSince1970] * 1000;
        _hash_code = [self hashCode];
//        self.tl_version = [CLDeviceIOS single].tl_version;
//        self.sys_version = [CLDeviceIOS single].sys_version;
//        self.model = [[UIDevice currentDevice] model];
//        self.net_type = [CLDeviceIOS single].net_type;
//        self.mac = [CLEncoder ASCEncode:[CLDeviceIOS single].mac];
//        self.wifi = [CLDeviceIOS wifiMacEncode];
    }
    return self;
}

+ (instancetype)param
{
//    [self referenceReplacedKeyWhenCreatingKeyValues:YES];
    return [[self alloc] init];
}

- (NSString *)hashCode
{
//    NSString *baseStr = [NSString stringWithFormat:@"%@%lld%@%@%ld", _lang, _t, secureKey, _did, (long)_tlb];
    
    NSString *baseStr = [NSString stringWithFormat:@"%@%lld%@%@%ld", _lang, _t, [CLProfileInfo sharedProfileInfo].securityKEY , _did, (long)_tlb];
//    DLog(@"baseStr: %@", baseStr);
    return [CLEncoder MD5String:baseStr];
    
}
@end
